PROJ_NAME=login
TARGET = build/$(PROJ_NAME)
# Variables 
CC = gcc 
CFLAGS = -Iinclude -Wall -g --std=c89
OBJ_DIR= build/obj
SRC = src/main.c src/$(PROJ_NAME).c 
OBJ = $(SRC:src/%.c=$(OBJ_DIR)/%.o) 
# TARGET = my_program  
# Default rule: Build the target 
all: $(TARGET)  

test:all
	mkdir test -p
	cd test
	ln -s ../$(TARGET) test
	cd ..
	test/test $PATH
# Link the object files into the final executable 
$(TARGET): $(OBJ)
	$(CC) $(OBJ) -o $(TARGET)
# Compile .c files into .o files 
$(OBJ_DIR)/%.o: src/%.c  $(wildcard include/*.h)	
	mkdir -p $(OBJ_DIR)	
	$(CC) $(CFLAGS) -c $< -o $@  
# Clean rule to remove build artifacts 
clean: 	
	rm -rf build $(TARGET) test/test 
# Phony targets to avoid conflicts with file names 
.PHONY: all clean test
